package com.jisf.driver.exception;

import com.jisf.driver.response.GlobalConstant;
import com.jisf.driver.response.IErrorCode;

/**
 * @Classname TockenException
 * @Description TODO
 * @Date 2022/4/5 22:37
 * @Created by jisf：【429627912@qq.com】
 */
public class TokenException extends RuntimeException{
    private Integer code;
    private String message;

    public TokenException(String message){
        this.code = GlobalConstant.TOKEN_CODE;
        this.message = message;
    }

    public TokenException(Throwable e){
        this.code = GlobalConstant.TOKEN_CODE;
        this.message = e.getMessage();
    }

    public TokenException(IErrorCode iErrorCode){
        this.code = iErrorCode.getCode();
        this.message = iErrorCode.getMessage();
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
